﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ManageAccount.aspx.cs" Inherits="ManageAccount" Title="Manage Patron Account" %>

<asp:Content ID="Content1" ContentPlaceHolderID="leftSide" Runat="Server">
    <br />
    Do you want to update your account information?
    <asp:Label ID="lblPersonID" runat="server" Visible="False"></asp:Label>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="PersonID" DataSourceID="SqlDataSource1" 
        OnRowUpdated="GridView1_RowUpdated" BorderStyle="Solid" BorderWidth="2px">
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="PersonID" HeaderText="PersonID" 
                InsertVisible="False" ReadOnly="True" SortExpression="PersonID" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="Address" HeaderText="Address" 
                SortExpression="Address" >
                <ItemStyle HorizontalAlign="Left" Width="150px" />
            </asp:BoundField>
            <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
            <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
            <asp:BoundField DataField="Zip" HeaderText="Zip" SortExpression="Zip" />
            <asp:BoundField DataField="PhoneNumber" HeaderText="PhoneNumber" 
                SortExpression="PhoneNumber" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:CheckBoxField DataField="wantsNewsletter" HeaderText="wantsNewsletter" 
                SortExpression="wantsNewsletter" />
        </Columns>
    </asp:GridView>
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BPI_LibraryConnectionString %>" 
        SelectCommand="PERSON_Select" SelectCommandType="StoredProcedure" 
        UpdateCommand="PERSON_UPDATE" UpdateCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="lblPersonID" Name="value" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="PersonId" Type="Int32" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="State" Type="String" />
            <asp:Parameter Name="Zip" Type="Int32" />
            <asp:Parameter Name="PhoneNumber" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="wantsNewsletter" Type="Boolean" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="PersonID" DataSourceID="SqlDataSource2" 
        OnRowUpdated="GridView2_RowUpdated" BorderStyle="Solid" BorderWidth="2px">
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="PersonID" HeaderText="PersonID" ReadOnly="True" 
                SortExpression="PersonID" />
            <asp:BoundField DataField="Password" HeaderText="Password" 
                SortExpression="Password" />
            <asp:CheckBoxField DataField="isAdult" 
                HeaderText="isAdult" SortExpression="isAdult" ReadOnly="True" />
            <asp:CheckBoxField DataField="wantsNotifications" 
                HeaderText="wantsNotifications" SortExpression="wantsNotifications" />
            <asp:BoundField DataField="PreferredContactMethod" 
                HeaderText="PreferredContactMethod" SortExpression="PreferredContactMethod" />
            <asp:BoundField DataField="Fines" HeaderText="Fines" ReadOnly="True" 
                SortExpression="Fines" />
            <asp:BoundField DataField="CardExpires" HeaderText="CardExpires" ReadOnly="True" 
                SortExpression="CardExpires" />
        </Columns>
    </asp:GridView>
    <br />
    <br />
    <br />
    <br />
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BPI_LibraryConnectionString %>" 
        SelectCommand="PATRON_Select" SelectCommandType="StoredProcedure" 
        UpdateCommand="PATRON_Update" UpdateCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="lblPersonID" Name="value" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="person" Type="Int32" />
            <asp:Parameter Name="wantsNotifications" Type="Boolean" />
            <asp:Parameter Name="PreferredContactMethod" Type="String" />
            <asp:Parameter Name="password" Type="String" />
            <asp:Parameter Name="isAdult" Type="Int32" />
            <asp:Parameter Name="fines" Type="Int32" />
            <asp:Parameter Name="cardExp" DbType="Date" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblConfirm" runat="server" Text=""></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="btnFinish" runat="server" Text="Return" 
        onclick="btnFinish_Click" />
&nbsp;
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="center" Runat="Server">
</asp:Content>

